import { _decorator, Component, Node, resources, SpriteFrame } from 'cc';
import Singleton from '../Base/Singleton';
/**资源管理器 */
export default class ResourceManager extends Singleton {

    static get Instance() {
        return super.getInstance<ResourceManager>();
    }
    loadDir(path: string, type: typeof SpriteFrame = SpriteFrame) {
        return new Promise<SpriteFrame[]>((resolve, reject) => {
            resources.loadDir(path, type, function (err, res) {
                if (err) {
                    reject(err);
                    return;
                } else {
                    resolve(res);
                }
            });
        });
    }

}



